<% define_content :link do %>
  <%= login_url %>
<% end %>

<% define_content :subject do %>
  {{#t}}Forgot Password: Canvas{{/t}}
<% end %>

<p>{{#t}}You requested a confirmation of your password for logging into Canvas.{{/t}}</p>

<% pseudonyms = asset.user.all_active_pseudonyms %>
<% first_pseudonym = pseudonyms.first %>
<% if pseudonyms.length > 1 -%>
  <p><%= before_label('associated_with_accounts', 'This address is associated with the following accounts') %></p>

  <% pseudonyms.each do |p| %>
    <p>- <%= t('login_at_account', '%{login_email} at %{account_name}', :login_email => p.unique_id, :account_name => p.account.display_name) %><br/>
    <% if p.managed_password? %>
      <%= t('login_managed_by_account', "this login's credentials are managed by %{account_name}", :account_name => p.account.name) %>
    <% else %>
      <%= before_label('change_password_at', "change this login's password at") %>
        <% channel = p.communication_channel || asset %>
        <% url = confirm_change_password_url(p, channel.confirmation_code, host: HostUrl.context_host(p.account)) %>
        <a href="<%= url %>"><%= url %></a>
    <% end %>
    </p>
  <% end %>
<% else %>
  <p><%= t('associated_login', 'This address is associated with the login, "%{login_identifier}".', :login_identifier => first_pseudonym.unique_id) %></p>
  <% if first_pseudonym.managed_password? %>
    <p><%= t('password_from_account', "The password for this login should have been given to you by the system administrators at %{account_name}, and Instructure doesn't have access to your password.  If your password is not working, please contact the system administrators about changing or verifying your password.", :account_name => first_pseudonym.account.display_name) %></p>
  <% else %>
    <p><a href="<%= confirm_change_password_url(first_pseudonym, asset.confirmation_code, host: HostUrl.context_host(first_pseudonym.account)) %>">{{#t}}Click here to set a new password{{/t}}</a><% end %>
<% end %>
